package ren.kane.phoenix.some.thread;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author renrk(1275) on 2018-11-02 11:00 AM
 **/
public class TaskCallable implements Callable<Object> {

    @Override
    public Object call() throws Exception {
        for (int i = 0; i < 1000; i++) {
            System.out.println("自定义线程任务在执行" + i);
        }
        return null;
    }

    public static void main(String[] args) {
        ExecutorService service = Executors.newFixedThreadPool(3);
        TaskCallable c = new TaskCallable();
        service.submit(c);
        service.submit(c);
        service.shutdown();
    }
}
